/* 储存合同管理-基础设置相关请求 */

import { ajaxService } from '@/utils/request';
import {
  PostContractCodeInfo,
  PostContractSettingItem,
  PostContractTemplate,
  PutContractTemplate,
  postElectronicseal,
  putElectronicseal,
  addElectronicseal,
} from '../type';

const env = import.meta.env;
let baseURL = env.VITE_API_BASE_URL;

/* 合同 编号 设置模块  */

// 获取合同编号数据
export function GetContractCodeInfo() {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/GetNumRule',
    method: 'get',
    baseURL,
  });
}

// 修改合同编号
export function PostContractCodeInfo(data: PostContractCodeInfo[]) {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/SetNumRule',
    method: 'post',
    baseURL,
    data,
  });
}

/* ----------------------------------- ---------------------------------------------------------------------------------------------------------*/

/* 合同 类型 设置模块  */

// 获取 合同类型 设置数据
export function GetContractTypeSetting() {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/GetConType',
    method: 'get',
    baseURL,
  });
}

// 添加 合同类型 控件
export function PostContractTypeSettingItem(data: PostContractSettingItem) {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/AddConType',
    method: 'post',
    baseURL,
    data,
  });
}

// 删除 合同类型 控件
export function DeleteContractTypeSettingItem(id: number) {
  return ajaxService({
    url: `http://192.168.0.120:9009/contract/DeleteConType/${id}`,
    method: 'delete',
    baseURL,
  });
}

/* ----------------------------------- ---------------------------------------------------------------------------------------------------------*/

/* 合同 状态 设置模块  */

// （暂定取消）

// // 获取 合同状态 设置数据
// export function GetContractStateSetting() {
//   return ajaxService({
//     url: '/contract/GetConType',
//     method: 'get',
//     baseURL,
//   })
// }

// // 添加 合同状态 控件
// export function PostContractStateSettingItem(data: PostContractSettingItem) {
//   return ajaxService({
//     url: '/contract/AddConType',
//     method: 'post',
//     baseURL,
//     data
//   })
// }

// // 删除 合同状态 控件
// export function DeleteContractStateSettingItem(id: number) {
//   return ajaxService({
//     url: `/contract/DeleteConType/${id}`,
//     method: 'delete',
//     baseURL,
//   })
// }

/* ----------------------------------- ---------------------------------------------------------------------------------------------------------*/

/* 合同 审批 设置模块  */

/* ----------------------------------- ---------------------------------------------------------------------------------------------------------*/

/* 合同 模板  */

// 获取全部合同模板（外层）
export function GetContractTemplate() {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/template/edit',
    method: 'get',
    baseURL,
  });
}

// 新增 合同模板（外层）
export function PostContractTemplate(data: PostContractTemplate) {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/template/add',
    method: 'post',
    baseURL,
    data,
  });
}

// 修改 合同模板（外层）
export function PutContractTemplate(data: PutContractTemplate) {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/template/edit',
    method: 'put',
    baseURL,
    data,
  });
}

// 删除 合同模板（外层）
export function DeleteContractTemplate(id: number) {
  return ajaxService({
    url: `http://192.168.0.120:9009/contract/template/delDesignTempIn${id}`,
    method: 'delete',
    baseURL,
  });
}

/* ----------------------------------- ---------------------------------------------------------------------------------------------------------*/

/* 电子签章   */

export function GetElectronicseal(params: postElectronicseal) {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/GetElecSeal',
    method: 'get',
    params,
    // baseURL,
  });
}

// 修改印章
export function Modifyseal(data: putElectronicseal) {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/EditSealName',
    data,
    method: 'PUT',
  });
}

//  查找电子印章使用人
export function findElectronicsealUser(id: number) {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/GetUserBy',
    method: 'get',
    params: id,
  });
}

// 添加电子签章
export function addElectronicseal(data: addElectronicseal) {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/ADDSeal',
    data,
    method: 'post',
  });
}

// 删除电子签章
export function DeletingElectronicseal(id: number) {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/DeleteSealByID',
    method: 'delete',
    params: id,
  });
}

// 添加获取印章类型
export function GetSealtype() {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/getConType',
    method: 'get',
  });
}

// 添加获取印章
export function GetSealspecs() {
  return ajaxService({
    url: 'http://192.168.0.120:9009/contract/GetShType',
    method: 'get',
  });
}

/* ----------------------------------- ---------------------------------------------------------------------------------------------------------*/

/*   */
